<?php
class CF_Storage_Array extends CF_Storage_Abstract
{
	/**
	 * 
	 * @param array $data
	 * @param boolean $readOnly
	 * @return void
	 */
	public function __construct(array $data = array(), $readOnly = false)
	{
		$this->_readOnly = $readOnly;
		$this->read($data);
	}
	
	/**
	 * 
	 * @param array $data
	 * @return CF_Storage_Array $this
	 */
	public function read(array $data)
	{
		foreach ($data as & $v){
			if(is_array($v)) $v = new self($v, $this->_readOnly);
		}
		
		$this->_data = $data;
		$this->rewind();
		return $this;
	}
}